<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>操作员权限分配</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/common.css"/>" type="text/css" rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<script type="text/javascript">

	$(document).ready(
			function() {
			
			$("#szPower").click(
						function() {
							var dd = $("input[name=multi_sel]:checked");
							if(dd.length != 1){
								alert("请选择一个操作员进行权限设置");
								return false;
							}
							var accountNo = dd.val();
							if(dd.length == 0){
								alert("请选择操作员");
								return false;
							}else{
								$("#queryUserForm").removeAttr("action");
								var faultAddr = encodeURI(accountNo);
       								faultAddr = "queryPowerYJ.ct?merchant.accountNo="+encodeURI(faultAddr);
       							$("#queryUserForm").attr("action",faultAddr);
       							$("#queryUserForm").submit();
								 
							}
							
						});
				$("#szModelPower").click(
						function() {
							var dd = $("input[name=multi_sel]:checked");
							if(dd.length != 1){
								alert("请选择一个操作员进行权限设置");
								return false;
							}
							var accountNo = dd.val();
							if(dd.length == 0){
								alert("请选择操作员");
								return false;
							}else{
								$("#queryUserForm").removeAttr("action");
								var faultAddr = encodeURI(accountNo);
       								faultAddr = "szModelPower.ct?merchant.accountNo="+encodeURI(faultAddr);
       							$("#queryUserForm").attr("action",faultAddr);
       							$("#queryUserForm").submit();
								/* var faultAddr = encodeURI(accountNo);
       								faultAddr = encodeURI(faultAddr);
								window.location.href="/fmposm/powers/szModelPower.ct?merchant.accountNo="+faultAddr;
								return false; */
							}
							
						});
				//设置数据分析系统权限
				$("#szAnalyPower").click(function(){
					var dd = $("input[name=multi_sel]:checked");
					if(dd.length != 1){
						alert("请选择一个公司内部角色进行权限设置");
						return false;
					}
					var accountNo = dd.val();
					if(dd.length == 0){
						alert("请选择一个公司内部角色进行权限设置");
						return false;
					}else{
						$("#queryUserForm").removeAttr("action");
						var faultAddr = encodeURI(accountNo);
							faultAddr = "szAnalyPower.ct?merchant.accountNo="+encodeURI(faultAddr);
							$("#queryUserForm").attr("action",faultAddr);
							$("#queryUserForm").submit();
						/* var faultAddr = encodeURI(accountNo);
								faultAddr = encodeURI(faultAddr);
						window.location.href="/fmposm/powers/szModelPower.ct?merchant.accountNo="+faultAddr;
						return false; */
					}
				});
				
				
				$("#queryBtn").click(function(){
					var faultAddr = encodeURI(accountNo);
						faultAddr = "queryMerchantListYJ.ct";
					$("#queryUserForm").attr("action",faultAddr);
					$("#queryUserForm").submit();
				});
			});

	
</script>



</head>

<body>
		<s:form id="queryUserForm" action="/powers/queryMerchantListYJ.ct" method="post"
			theme="simple">
		<table class="tb">
		    <tbody>
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div></td>
		        </tr>
		
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h3">操作员权限分配</div></td>
		        </tr>
				<tr class="tb-line">
                
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">所属机构：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-select">
							<s:select cssClass="queryWidth" name="searchCondition.orgCode"
								id="orgCode"
								list="#request.orgList" listKey="insIdCd" listValue="insName"/>
                	</label>
				</td>
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">角色类型：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-select">
					<s:select cssClass="queryWidth" name="searchCondition.roleType"
								id="roleType"
								list="#request.roleList" listKey="key" listValue="value" headerKey="99" headerValue="--请选择--"/>	
                	</label>
				</td>
						</tr>
				<tr class="tb-line">
					
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">操作员账号：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-input-normal"><s:textfield id="accountNo"
							name="searchCondition.accountNo" cssClass="queryWidth" />
                	</label>
				</td>
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">操作员姓名：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-input-normal">
                		<s:textfield id="realName"
							name="searchCondition.realName" cssClass="queryWidth" />
                	</label>
				</td>
				</tr>
				<tr class="tb-line">
					
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">手机号：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-input-normal">
                		<s:textfield id="mobile"
							name="searchCondition.mobile" cssClass="queryWidth" />
                	</label>
				</td>
					
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">证件号：</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-input-normal">
                		<s:textfield id="cardNo"
							name="searchCondition.cardNo" cssClass="queryWidth" />
                	</label>
				</td>
				</tr>
				
				<tr class="tb-line">
						<td colspan="4" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
				<tr class="tb-line">
					<td class="tb-td line-submit" align="right" colspan="4">
                		<label class="tb-input-submit">
							<s:submit id="queryBtn" value="查  询" />
		                </label>
		                <label class="tb-input-submit">
		                	<s:reset value="取 消" />
		                </label>
		            </td>
				</tr>
				<tr class="tb-line">
					<td class="tb-td line-submit" align="right" colspan="4">
					<s:if
					 test="#request.searchRsList != null && #request.searchRsList.size>0">
                		<label class="tb-input-submit">
					   		<s:submit id="szPower" value="设置权限" />
						</label>
                		<label class="tb-input-submit">
							<s:submit id="szModelPower" value="选择模板设置权限" />
						</label>
					   <!-- 设置数据分析平台的菜单权限  只有dxpeng 管理员账号有此权限-->
					   
					   <s:if test="#request.roleType==\"00\"">
						   <label class="tb-input-submit">
						   		<s:submit id="szAnalyPower" value="设置数据分析平台权限" />
						  </label>
					  </s:if>
					</s:if>
					<s:else>
                		<label class="tb-input-submit">
					 		<s:submit id="szPower" disabled="true"
								value="设置权限" /> 
						</label>
                		<label class="tb-input-submit">
							<s:submit id="szModelPower" disabled="true" value="选择模板设置权限" />
						</label>
					</s:else>
					</td>
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging"  align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/powers/queryMerchantListYJ.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
			</s:form>
		<div class="big-tb">
		    <table class="tb" style="width: 100%;" id="tableList">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="13">操作员基本信息列表</th>
		            </tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">选择</th>
						<th class="tb-th">账号</th>
						<th class="tb-th">姓名</th>
						<th class="tb-th">性别</th>
						<th class="tb-th">手机号</th>
						<th class="tb-th">所属机构</th>
						<th class="tb-th">角色类型</th>
						<th class="tb-th">证件号</th>
						<th class="tb-th">状态</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.operatorList" status="stat" id="oper">
							<tr class="tb-line">
							<td class="tb-td" align="center">
							<%-- <s:property value="#session.session_merchant.id"/>- 
							<s:property value="#oper.id"/> --%>
								<s:if test="#oper.status == \"正常\"">
								  <s:if test="#session.session_merchant.id==#oper.id">
								  <s:checkboxlist disabled="true" name="multi_sel" list="#{#oper.accountNo:''}"  theme="simple" />
					        	
								  </s:if>
								  <s:else>
								   <s:checkboxlist name="multi_sel" list="#{#oper.accountNo:''}"  theme="simple" />
					     
								  </s:else>
								 
								</s:if>
								<s:else>
					        	      <s:checkboxlist disabled="true" name="multi_sel" list="#{#oper.accountNo:''}"  theme="simple" />
					        	</s:else>
						       </td>
							<td class="tb-td" align="center">
							 <s:property value="#oper.accountNo"/>
							</td>
							<td class="tb-td" align="center">
							<s:property value="#oper.realName"/>
							</td>
					        <td class="tb-td" align="center"> 
					        <s:property value="#oper.sex"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.mobile"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.orgCode"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.roleType"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.cardNo"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.status"/>
							</td>
						</s:iterator>
				</tbody>
			</table>
			</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
